
// 1. 要有组件

import { createWebHashHistory, createRouter } from 'vue-router';

// 2. 定义一些路由（路径与组件之间的映射）
const routes = [
    // 后台管理员
    {name: 'login',path: '/login', component: ()=>import('@/components/Login.vue')},
    {name: 'index', path: '/', component: ()=>import('@/components/Index.vue'), children: [
        {name: 'charts',path: '/charts', component: ()=>import('@/components/Charts.vue')},
        {name: 'admin',path: '/admin', component: ()=>import('@/components/Admin.vue')},
        {name: 'coach',path: '/coach', component: ()=>import('@/components/Coach.vue')},
        {name: 'course',path: '/course', component: ()=>import('@/components/Course.vue')},
        {name: 'courseCalendar',path: '/courseCalendar', component: ()=>import('@/components/CourseCalendar.vue')},
        {name: 'member',path: '/member', component: ()=>import('@/components/Member.vue')},
        {name: 'reserve',path: '/reserve', component: ()=>import('@/components/Reserve.vue')},
    ]},
];

// 3. 创建路由
const router = createRouter({
    history: createWebHashHistory(),    // 历史记录
    routes: routes,
});

// 路由是否已经加载
router.load = false;

// 4. 暴露
export default router